#include "OgreURLPlugin.h"

#include <OgreRoot.h>

namespace Ogre
{

//-------------------------------------------------------------------------------------------------------------------------------------------------
URLPlugin* gURLPlugin = NULL;
//-------------------------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------------------------
extern "C" void _OgrePluginURLExport dllStartPlugin(void)
{
	assert( !gURLPlugin && "Application bug, dllStartPlugin is called twice" );

	// Create new plugin
	gURLPlugin = OGRE_NEW URLPlugin();

	// Register plugin instance
	Root::getSingleton().installPlugin( gURLPlugin );
}

//-------------------------------------------------------------------------------------------------------------------------------------------------
extern "C" void _OgrePluginURLExport dllStopPlugin(void)
{
	assert( gURLPlugin && "Application bug, dllStopPlugin: Plugin not initialised" );

	// Remove plugin instance
	Root::getSingleton().uninstallPlugin( gURLPlugin );

	// Destroy plugin instance
	OGRE_DELETE gURLPlugin;
	gURLPlugin = NULL;
}

} // end of namespace Ogre
